CREATE NONCLUSTERED INDEX idx_issue_sales_key ON performance.issue_sale(issue_sales_key);
CREATE NONCLUSTERED INDEX idx_dpr_date ON performance.issue_sale(dpr_date);

CREATE NONCLUSTERED INDEX idx_issue_sales_key ON performance.sales_map(issue_sales_key);
CREATE NONCLUSTERED INDEX idx_submit_sales_key ON performance.sales_map(submit_sales_key);
CREATE NONCLUSTERED INDEX idx_submit_sales_sub_key ON performance.sales_map(submit_sales_sub_key);


CREATE NONCLUSTERED INDEX idx_submit_sales_key ON performance.submit_sale(submit_sales_key);
CREATE NONCLUSTERED INDEX idx_submit_sales_sub_key ON performance.submit_sale(submit_sales_sub_key);
CREATE NONCLUSTERED INDEX idx_agent_code ON performance.submit_sale(agent_code);
CREATE NONCLUSTERED INDEX idx_submit_date_time ON performance.submit_sale(submit_date_time);
CREATE NONCLUSTERED INDEX idx_contract_num ON performance.submit_sale(contract_num);
GO

ALTER TABLE performance.submit_sale
ADD CONSTRAINT idx_key_sub_key UNIQUE (submit_sales_key,submit_sales_sub_key);

GO


CREATE NONCLUSTERED INDEX idx_dpr_date_1 ON [performance].[issue_sale]
(
       [dpr_date] ASC,
       [issue_sales_key] ASC
)
INCLUDE (    [issue_case_count],
       [issue_pc]) WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY];

CREATE NONCLUSTERED INDEX idx_submit_sales_key_1 ON [performance].[sales_map]
(
       [submit_sales_key] ASC,
       [submit_sales_sub_key] ASC,
       [issue_sales_key] ASC
)WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY];

CREATE NONCLUSTERED INDEX idx_agent_code_1
ON [performance].[submit_sale] ([agent_code])
INCLUDE ([submit_case_count],[submit_date_time],[submit_pc],[submit_sales_key],[submit_sales_sub_key])



